home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F24704_ShowMax.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2001-10-05  |  2.3 KB  |  70 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  3.   <xsl:output method="html" indent="yes" />
  4.   <xsl:include href="Max.xsl" />
  5.   <xsl:template match="/">
  6.     <html>
  7.       <head>
  8.         <title>Stylesheet Example</title>
  9.         <style type="text/css"><![CDATA[
  10.         H1 {COLOR: red; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  11.         H2 {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  12.         .head {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  13.         .subhead {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  14.         .text {COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  15.         TH {COLOR: white; FONT-FAMILY: Arial; background-color: darkblue;}
  16.         TD {COLOR: darkblue; FONT-FAMILY: Arial}
  17.         TR { background-color: beige; }
  18.         BODY { background-color: beige; }
  19.         ]]></style>
  20.       </head>
  21.       <body>
  22.         <xsl:apply-templates />
  23.       </body>
  24.     </html>
  25.   </xsl:template>
  26.  
  27.   <xsl:template match="weather">
  28.     <h1>Temperatures for: 01/21/2001 - 01/28/2001</h1>
  29.     <xsl:apply-templates />
  30.   </xsl:template>
  31.  
  32.   <xsl:template match="temperatures">
  33.     <h2>City:
  34.     <xsl:value-of select="@city" />
  35.     </h2>
  36.     <!-- Display Table Headers -->
  37.     <table border="1">
  38.       <tr>
  39.         <th>date</th>
  40.         <th>Temperatue(F)</th>
  41.       </tr>
  42.       <!-- Display each temperature for the city as a row in the table -->
  43.       <xsl:for-each select="temperature">
  44.         <tr>
  45.           <td>
  46.             <xsl:value-of select="@date" />
  47.           </td>
  48.           <td>
  49.             <xsl:value-of select="." />
  50.           </td>
  51.         </tr>
  52.       </xsl:for-each>
  53.     </table>
  54.     <!-- Display Call the "Max" template to determine the
  55.     maximum temperature for the temperature nodes-->
  56.     <xsl:variable name="nMaxTemp">
  57.       <xsl:call-template name="Max">
  58.         <xsl:with-param name="list" select=".//temperature" />
  59.         <xsl:with-param name="nMax" select="'-99999'" />
  60.       </xsl:call-template>
  61.     </xsl:variable>
  62.  
  63.     <!-- Display the minimum temperature calculated by the Min template-->
  64.     <h3>The Highest Temperature is:
  65.       <xsl:value-of select="$nMaxTemp" />
  66.     </h3>
  67.     <br />
  68.   </xsl:template>
  69. </xsl:stylesheet>
  70.